package com.BaoHua.demo.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.BaoHua.demo.webservice.ip.ArrayOfString;
import com.BaoHua.demo.webservice.ip.IpAddressSearchWebServiceSoap;

/**
 * ip查询接口,支持restful
* @ClassName: IpController  
* @author yanfa00027  
* @date 2018年10月17日  
*
 */
@RestController
public class IpController {

	@Autowired
    private IpAddressSearchWebServiceSoap soap;
	
	/**
	 * ip查询
	* @Title: IpAddress  
	* @param @param ip
	* @param @return    参数  
	* @return ArrayOfString    返回类型  
	* @throws
	 */
	@RequestMapping("/ip/ipAddress/{ip:.+}")
	public ArrayOfString IpAddress(@PathVariable("ip") String ip) {
		return soap.getCountryCityByIp(ip);
	}
	
	/**
	 * get请求
	* @Title: Ip_Get  
	* @param @param ip
	* @param @return    参数  
	* @return ArrayOfString    返回类型  
	* @throws
	 */
	@GetMapping("/ip/restful")
	public ArrayOfString Ip_Get(String ip) {
		return soap.getCountryCityByIp(ip);
	}
	
	/**
	 * post请求
	* @Title: Ip_Post  
	* @param @param ip
	* @param @return    参数  
	* @return ArrayOfString    返回类型  
	* @throws
	 */
	@PostMapping("/ip/restful")
	public ArrayOfString Ip_Post(String ip) {
		return soap.getCountryCityByIp(ip);
	}
}
